package com.yuanjin.main;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.yuanjin.R;
import com.yuanjin.activity.Map_MainActivity;
import com.yuanjin.activity.Note_Activity;

public class FragmentSchoolInOut extends Fragment implements OnClickListener {
	private Activity mactivity;
	private Intent intent;

	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		mactivity = activity;
	}

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater
				.inflate(R.layout.fragment_schoolinout, container, false);
	}

	@Override
	public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onViewCreated(view, savedInstanceState);
		RelativeLayout rl_friend = (RelativeLayout) view
				.findViewById(R.id.rl_friend);
		RelativeLayout rl_union = (RelativeLayout) view
				.findViewById(R.id.rl_union);
		RelativeLayout rl_act = (RelativeLayout) view.findViewById(R.id.rl_act);
		rl_act.setOnClickListener(this);
		rl_friend.setOnClickListener(this);
		rl_union.setOnClickListener(this);
	}

	@Override
	public void onActivityCreated(@Nullable Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.rl_friend:// 社交
			intent = new Intent(mactivity, Note_Activity.class);
			startActivity(intent);
			break;
		case R.id.rl_union:// 联盟
			intent = new Intent(mactivity, Map_MainActivity.class);
			startActivity(intent);
			break;

		case R.id.rl_act:// 活动

			break;

		default:
			break;
		}
	}
}
